.TH std::ranges::views::as_rvalue,std::ranges::as_rvalue_view 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::ranges::views::as_rvalue,std::ranges::as_rvalue_view \- std::ranges::views::as_rvalue,std::ranges::as_rvalue_view

.SH Synopsis
   Defined in header <ranges>
   template< ranges::view V >

       requires ranges::input_range<V>                                \fB(1)\fP (since C++23)
   class as_rvalue_view

       : public ranges::view_interface<as_rvalue_view<V>>
   namespace views {

       inline constexpr /* unspecified */ as_rvalue = /* unspecified  \fB(2)\fP (since C++23)
   */;

   }
   Call signature
   template< ranges::viewable_range R >

       requires /* see below */                                           (since C++23)

   constexpr ranges::view auto as_rvalue( R&& r );

   1) A range adaptor that represents a view of underlying view whose elements are
   rvalues.
   2) RangeAdaptorObject. Let e be a subexpression and let T be decltype((e)). Then the
   expression views::as_rvalue(e) is expression-equivalent to:
     * views::all(e), if it is a well-formed expression and
       std::same_as<ranges::range_rvalue_reference_t<T>, ranges::range_reference_t<T>>
       is true;
     * as_rvalue_view{e} otherwise.

.SH Member functions

   constructor   constructs an as_rvalue_view
                 \fI(public member function)\fP
   base          returns the underlying view V
                 \fI(public member function)\fP
   begin         returns the beginning iterator of the as_rvalue_view
                 \fI(public member function)\fP
   end           returns the end iterator of the as_rvalue_view
                 \fI(public member function)\fP
   size          returns the size of the view if it is bounded
                 \fI(public member function)\fP
         Inherited from std::ranges::view_interface
   empty         returns whether the derived view is empty. Provided if it satisfies
   (C++20)       sized_range or forward_range.
                 \fI(public member function of std::ranges::view_interface<D>)\fP
   cbegin        returns a constant iterator to the beginning of the range.
   (C++23)       \fI(public member function of std::ranges::view_interface<D>)\fP
   cend          returns a sentinel for the constant iterator of the range.
   (C++23)       \fI(public member function of std::ranges::view_interface<D>)\fP
   operator bool returns whether the derived view is not empty. Provided if
   (C++20)       ranges::empty is applicable to it.
                 \fI(public member function of std::ranges::view_interface<D>)\fP
   front         returns the first element in the derived view. Provided if it
   (C++20)       satisfies forward_range.
                 \fI(public member function of std::ranges::view_interface<D>)\fP
   back          returns the last element in the derived view. Provided if it satisfies
   (C++20)       bidirectional_range and common_range.
                 \fI(public member function of std::ranges::view_interface<D>)\fP
   operator[]    returns the n^th element in the derived view. Provided if it satisfies
   (C++20)       random_access_range.
                 \fI(public member function of std::ranges::view_interface<D>)\fP

std::ranges::as_rvalue_view::as_rvalue_view

   as_rvalue_view() requires std::default_initializable<V> = default; \fB(1)\fP (since C++23)
   constexpr explicit as_rvalue_view( V base );                       \fB(2)\fP (since C++23)

   1) Value-initializes base_ via its default member initializer (= V()).
   2) Initializes base_ with std::move(base).

.SH Parameters

   base - a view

std::ranges::as_rvalue_view::base

   constexpr V base() const& requires std::copy_constructible<V>; \fB(1)\fP (since C++23)
   constexpr V base() &&;                                         \fB(2)\fP (since C++23)

   Returns the underlying view.

   1) Copy-constructs the result from the underlying view. Equivalent to return base_;.
   2) Move-constructs the result from the underlying view. Equivalent to return
   std::move(base_);.

std::ranges::as_rvalue_view::begin

   constexpr auto begin() requires (!__simple_view<V>);          \fB(1)\fP (since C++23)
   constexpr auto begin() const requires ranges::range<const V>; \fB(2)\fP (since C++23)

   1,2) Returns std::move_iterator(ranges::begin(base_)).

std::ranges::as_rvalue_view::end

   constexpr auto end() requires (!__simple_view<V>);          \fB(1)\fP (since C++23)
   constexpr auto end() const requires ranges::range<const V>; \fB(2)\fP (since C++23)

   1) Returns std::move_iterator(ranges::end(base_)) if V models common_range,
   otherwise std::move_sentinel(ranges::end(base_)).
   2) Returns std::move_iterator(ranges::end(base_)) if const V models common_range,
   otherwise std::move_sentinel(ranges::end(base_)).

std::ranges::as_rvalue_view::size

   constexpr auto size() requires ranges::sized_range<V>;             \fB(1)\fP (since C++23)
   constexpr auto size() const requires ranges::sized_range<const V>; \fB(2)\fP (since C++23)

   Returns the size of the view if the view is bounded.

   1,2) Equivalent to return ranges::size(base_);

   Deduction guides

   template< class R >                                        (since C++23)
   as_rvalue_view( R&& ) -> as_rvalue_view<views::all_t<R>>;

   Helper templates

   template< class T >

   inline constexpr bool enable_borrowed_range<std::ranges::as_rvalue_view<T>>  (since
   =                                                                            C++23)

       std::ranges::enable_borrowed_range<T>;

   This specialization of std::ranges::enable_borrowed_range makes as_rvalue_view
   satisfy borrowed_range when the underlying view satisfies it.

.SH Notes

       Feature-test macro      Value    Std             Feature
   __cpp_lib_ranges_as_rvalue 202207L (C++23) std::ranges::as_rvalue_view

.SH Example

    This section is incomplete
    Reason: example

.SH See also

   move_iterator         iterator adaptor which dereferences to an rvalue
   \fI(C++11)\fP               \fI(class template)\fP
   move_sentinel         sentinel adaptor for use with std::move_iterator
   (C++20)               \fI(class template)\fP
   ranges::as_const_view converts a view into a constant_range
   views::as_const       \fI(class template)\fP (range adaptor object)
   (C++23)

.SH Category:
     * Todo with reason
